package com.guashu.springbooteasyexcel.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import org.apache.poi.ss.usermodel.FillPatternType;

import java.util.Date;

/**
 * @PACKAGE_NAME: com.lyl.excel
 * @ClassName: DemoData
 * @Description:  使用 EasyExcel 导出数据时的数据模版
 * @Date: 2021-01-27 17:46
 * @Author: [木子雷] 公众号
 **/

// 标题行 背景设置成红色 IndexedColors.RED.getIndex()
@HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 10)
// 标题行 字体设置成20
@HeadFontStyle(fontHeightInPoints = 20)
@ContentRowHeight(25)// 文本内容行的高度
@HeadRowHeight(30)// 标题行的高度
@ColumnWidth(20)// 全局的列宽
public class DemoData {

    // 字符串的列内容 背景设置成天蓝 IndexedColors.SKY_BLUE.getIndex()
    @ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 40)
    // 字符串的列内容 字体设置成20
    @ContentFontStyle(fontHeightInPoints = 20)
    @ExcelProperty({"导出测试：TEST", "字符串标题"})
    private String string;

    @ColumnWidth(30)
    @ExcelProperty({"导出测试：TEST", "日期标题"})
    private Date date;

    @ExcelProperty({"导出测试：TEST", "数字标题"})
    private Double doubleData;

    /**
     * 忽略这个字段
     */
    @ExcelIgnore
    private String ignore;

    public String getString() {
        return string;
    }

    public void setString(String string) {
        this.string = string;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Double getDoubleData() {
        return doubleData;
    }

    public void setDoubleData(Double doubleData) {
        this.doubleData = doubleData;
    }

    public String getIgnore() {
        return ignore;
    }

    public void setIgnore(String ignore) {
        this.ignore = ignore;
    }
}